import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from "axios";
import hljs from 'highlight.js'
import 'highlight.js/styles/atom-one-dark.css'
import {Drawer,Message,Avatar,Form,Row,Col,Icon,List,Button,Progress,Pagination,Tree,Timeline,Anchor,Affix,Empty,Comment,Spin,Input,Modal} from 'ant-design-vue'
Vue.use(Tree)
Vue.use(Row)
Vue.use(Col)
Vue.use(Icon)
Vue.use(List)
Vue.use(Button)
Vue.use(Progress)
Vue.use(Pagination)
Vue.use(Timeline)
Vue.use(Anchor)
Vue.use(Affix)
Vue.use(Empty)
Vue.use(Comment)
Vue.use(Spin)
Vue.use(Input)
Vue.use(Modal)
Vue.use(Form)
Vue.use(Avatar)
Vue.use(Drawer)
Vue.prototype.$message = Message;
Vue.config.productionTip = false


axios.interceptors.request.use(
  function(request) {
		//var token = base.userInfo.token;
		//request.headers["x-token"] = token;
		return request;
  },
  function(error) {
		return Promise.resolve(error);
  }
);
axios.interceptors.response.use(
	function(response) {
		return response.data	
	},
  function(error) {
		return Promise.resolve(error);
  }	
);
Vue.prototype.$http = axios;



Vue.directive('highlight', {
    deep: true,
    bind: highlight,
    update: highlight
});
function highlight(el, binding) {
    if (el.tagName !== 'CODE') {
        let blocks = el.querySelectorAll('code');
				blocks.forEach((block) => {
            highlight(block, binding);
        })
    } else {
        if (typeof binding.value === 'string') {
            el.textContent = binding.value;
        }
				if (el.parentElement.className == 'language-markup'){
					el.parentElement.className = 'language-html'	
				}
        hljs.highlightBlock(el);
    }
}


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
